(function () {
    var ul = document.querySelector(".header")
    var coin = "";
    // 2请求接口
    var xhr = new XMLHttpRequest();
    xhr.open("get", "http://chst.vip:1234/api/getindexmenu");
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                var tex = JSON.parse(xhr.responseText);
                console.log(tex.result[0].img);
                //存键名
                var jian = "";
                tex.result.forEach((value) => {
                    console.log(tex)
                    console.log(value.img);
                    value.img
                    ul.innerHTML += `<div class="box2">
                    ${value.img}
                        <div class="box3">${value.name}</div>
                   </div>`


                });


            }
        }

    }
    xhr.send(null)




    // 下面

    var bao = document.querySelector(".box");
    console.log(bao)
    //请求
    var la = new XMLHttpRequest();
    var regExp = /(?<=imgurl=)[^' "]*/;
    la.open("get", "http://chst.vip:1234/api/getmoneyctrl")
    la.onreadystatechange = function () {
        if (la.readyState === 4) {
            if (la.status === 200) {
                var anna = JSON.parse(la.responseText);
                console.log(anna);
                console.log(anna.result);
                console.log(anna.result[0]);
                anna.result.forEach((item) => {
                    console.log(item)
                    console.log(item.productInfo)
                    bao.innerHTML += `<li>

                   <span class="word"> ${item.productName}          </span>
              <span  class="price"> ${item.productPinkage}</span>
             
              <span class="shop">${item.productFrom}|${item.productTime}</span>
               <span class="com">${item.productComCount}</span>
             <img src="${regExp.exec(item.productImg2)[0]}"
                    </li>`


                })

            }
        }
    }
    la.send()






















}
)()












